<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/', function () {
    return view('welcome');
});

//模拟邮箱发送
Route::get('mail/send','MailController@send');


//excel表格导出
Route::get('excel/export','ExcelController@export');
//excel 导入
Route::get('excel/import','ExcelController@import');

//文件上传路由
Route::get('/upload','UploadController@upload');
Route::post('/upload/send','UploadController@send');

//生成二维码:
Route::get('/qrcode','UploadController@qrcode');
//生成验证码
Route::any('captcha-test', function()
{
    if (Request::getMethod() == 'POST')
    {
        $rules = ['captcha' => 'required|captcha'];
        $validator = Validator::make(Input::all(), $rules);
        if ($validator->fails())
        {
            echo '<p style="color: #ff0000;">Incorrect!</p>';
        }
        else
        {
            echo '<p style="color: #00ff30;">Matched :)</p>';
        }
    }

    $form = '<form method="post" action="captcha-test">';
    $form .= '<input type="hidden" name="_token" value="' . csrf_token() . '">';
    $form .= '<p>' . captcha_img() . '</p>';
    $form .= '<p><input type="text" name="captcha"></p>';
    $form .= '<p><button type="submit" name="check">Check</button></p>';
    $form .= '</form>';
    return $form;
});

Route::get('/info','UploadController@getInfo');
Route::get('/info/add','UploadController@addData');

//百度ue编辑器的路由
Route::get('/head',function(){
    return view('head');
});
//百度ue编辑器的路由的接收
Route::post('/ueditor/server','UploadController@ueUpload');

Route::get('auth/geetest','Auth\AuthController@getGeetest');


//支付宝支付处理路由
Route::get('alipay/pay','AlipayController@pay');
//支付后跳转路由
Route::post('alipay/return','AlipayController@result');
Route::post('/laravel-u-editor-server/server','UploadController@send');

//模拟参数
Route::get('/get/test','UploadController@test');
